﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Net.Http.Formatting;
using WebApiContrib.Formatting.Jsonp;

using Services.Common;
using Services.User;
using Services.Messages;
using Services.Business;
using Services.Activity;
using Services.PushNotification;
using Services.Form;
using Services.Share;
using Services.Group;
using Services.Tag;
using Services.Weixin;

using WordSegments;

using Microsoft.AspNet.SignalR.Client;

using WSServer;

namespace iShangMai
{
    public class WebApiApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            OPSegmentUtils.sharedInstance.Init(HttpRuntime.AppDomainAppPath + "Dict");

            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.USER, new ISMUserServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.FRIEND, new ISMFriendServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.BLACKLIST, new ISMBlacklistServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.PRIVATE_MESSAGES, new ISMPrivateMessageServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.BUSINESS,new ISMBusinessServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.ACTIVITIE, new ISMActivityServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.FORM, new ISMFormServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.GROUP, new ISMGroupServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.SHARE, new ISMShareServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.TAG, new ISMTagServiceProvider());
            ISMServiceStack.sharedInstance.RegisterService(ISMServiceStackKeys.WEIXIN, new ISMWeixinServiceProvider());
            Pusher.Init();
        }
    }
}
